﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IPagedList<Link>>" %>
<%@ Import Namespace="MvcPaging"%>
<%@ Import Namespace="BaLs.Models"%>

<asp:Content ID="indexHead" ContentPlaceHolderID="head" runat="server">
    <title>Home Page</title>
</asp:Content>

<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
<script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>  
<script src="http://bubble.websnapr.com/u5chb515mHmY/swh/" type="text/javascript"></script>
<body />
    <h2><%= Html.Encode(ViewData["Message"]) %></h2>
    <p>
     <% using (Html.BeginForm("Search","Home"))
        {
            if (ViewData["searchTag"] == null)
                ViewData["searchTag"] = "";
            %>
       Search links : <%=Html.TextBox("searchTag", ViewData["searchTag"])%> <input type="submit" value="Search" />
       <br /><font size="1" style="color:navy;font-style:italic;">enter tags to search</font>             
            
      <%  } %>
    </p>
    <p>
    <% foreach (var item in Model){ %>
       <div>
        <%=Html.Encode(item.title) %>
       <br /><font size=2><a href="<%=Html.Encode(item.url) %>" target=_blank> <%=Html.Encode(item.url) %></a></font> 
       <font size=1 style="background-color:Silver;"><a href="<%=Html.Encode(item.url) %>"  class="websnapr">Preview</a></font>
       <br /> <font size=2><b>Tags</b></font>
       <% foreach(var tag in item.Tags) { %>
        <font class=tag><%=Html.Encode(tag.tag_desc)%></font>
         <% }%>  
         <br /><div class="date">Last updated :<%=Html.Encode(item.create_date) %> 
                by <a href="<%=item.users[0].userid.ToString()%>"><%=item.users[0].name.ToString() %></a> <%=item.users.Count.ToString()%></div>            
       </div>       
       <hr/>
       <br />
    <%} %>   
          
    </p>
     <div class="pager">
		<%= Html.Pager(ViewData.Model.PageSize, ViewData.Model.PageNumber, ViewData.Model.TotalItemCount)%>
	</div>
	
</asp:Content>
